package jxerializeml.xml;

import java.util.Hashtable;

/**
 * Contains all informations about a node (element, tag) in a XML document.
 * It might be directly copied to such a document, or used for transfering
 * of informations from the document to the application logic.
 * 
 * @author Tomáš Zíma
 */
public class NodeBean {
	/** Name of the tag. */
	private String tagName = "";
	
	/**
	 * Contains all attributes. Key means name of the attribute and
	 * value represents the actual value of an attribute.
	 */
	private Hashtable<String, String> attributes = new Hashtable<>();

	/**
	 * @param tagName
	 *     Name of the tag.
	 */
	public void setTagName(String tagName) {
		this.tagName = tagName;
	}

	/**
	 * @return
	 *     Name of the tag.
	 */
	public String getTagName() {
		return tagName;
	}

	/**
	 * @param attribute
	 *     Name of the attribute.
	 *   
	 * @param value
	 *     Value of the attribute.
	 */
	public void setAttribute(String attribute, String value) {
		attributes.put(attribute, value);
	}

	/**
	 * @return
	 *     All attributes as a hashtable, where the
	 *     keys are name of the attributes.
	 */
	public Hashtable<String, String> getAttributes() {
		return attributes;
	}
}
